﻿Imports System.Collections.Generic
Imports System.Data.SqlClient
Namespace QuanLyKhachHang
    Public Class ThongKeXuatKhoDAL
        Public Function ThongKeXuatKho(ByVal TuNgay As Integer, ByVal ToiNgay As Integer, ByVal MaSo As String) As List(Of ThongKeXuatKhoInfo)
            Try
                Dim SQLHelper As New SQLDataHelper
                Dim Reader As SqlDataReader
                SQLHelper.AddParameter("@TuNgay", TuNgay)
                SQLHelper.AddParameter("@ToiNgay", ToiNgay)
                SQLHelper.AddParameter("@MaSo", MaSo)
                Reader = SQLHelper.ExecuteReader("sp_ThongKeXuatKho", CommandType.StoredProcedure)
                Dim item As ThongKeXuatKhoInfo
                Dim list As New List(Of ThongKeXuatKhoInfo)
                While (Reader.Read())
                    item = New ThongKeXuatKhoInfo
                    item.So = Reader("So").ToString()
                    item.NgayNhapKho = Reader("NgayNhapKho").ToString()
                    item.MaSo = Reader("MaSo").ToString()
                    item.TenGoi = Reader("TenGoi").ToString()
                    item.SoLuong = Reader("SoLuong").ToString()
                    item.DienGiai = Reader("DienGiai").ToString()
                    item.TenDonVi = Reader("TenDonVi").ToString()
                    item.SoLuongTheoQuyCach = Reader("SoLuongTheoQuyCach").ToString()
                    item.SoLuongTheoDVT = Reader("SoLuongTheoDVT").ToString()
                    list.Add(item)
                End While
                Return list
            Catch ex As Exception
                Throw ex
            End Try
        End Function
        Public Function ThongKeXuatKho_TongXuat(ByVal TuNgay As Integer, ByVal ToiNgay As Integer, ByVal MaSo As String) As List(Of TongXuatKhoInfo)
            Try
                Dim SQLHelper As New SQLDataHelper
                Dim Reader As SqlDataReader
                SQLHelper.AddParameter("@TuNgay", TuNgay)
                SQLHelper.AddParameter("@ToiNgay", ToiNgay)
                SQLHelper.AddParameter("@MaSo", MaSo)
                Reader = SQLHelper.ExecuteReader("sp_ThongKeXuatKho_TongXuat", CommandType.StoredProcedure)
                Dim item As TongXuatKhoInfo
                Dim list As New List(Of TongXuatKhoInfo)
                While (Reader.Read())
                    item = New TongXuatKhoInfo
                    item.TongXuat = Single.Parse(Reader("TongXuat").ToString())
                    item.TongXuatDVT = Single.Parse(Reader("TongXuatDVT").ToString())
                    list.Add(item)
                End While
                Return list
            Catch ex As Exception
                Throw ex
            End Try
        End Function
    End Class
End Namespace


